<div id="inspect">
    <div class="more"><a href="contents/index/<?php echo $category_id ?>">ดูทั้งหมด</a></div>
      <img src="themes/bie/images/lbl_inspect.png" width="704" height="54" class="lbl" />
      
    <div id="tabs">
	<ul>
		<?php foreach($categories as $key => $category): ?>
		<li><a href="#tabs-<?php echo ++$key ?>"><?php echo $category->name ?></a></li>
		<?php endforeach; ?>
	</ul>
	<?php foreach($categories as $key => $category): ?>
	<div id="tabs-<?php echo ++$key ?>">
		<?php foreach($category->content->where("start_date <= date(sysdate()) and (end_date >= date(sysdate()) or end_date = date('0000-00-00')) and status = 'approve'")->limit(4)->order_by('id','desc')->get() as $content): ?>
		<div class="instbox"><a href="contents/view/<?php echo $content->id ?>"><img src="uploads/content/thumbnail/<?php echo $content->image ?>" width="64" height="59" align="left" class="thum" /></a>
    	<p class="title"><a href="contents/view/<?php echo $content->id ?>"><?php echo $content->title ?></a></p>
        <div class="download">
        	ลักษณะหนังสือ : <span>ปกติ</span>
			<?php if(is_file('uploads/contents/download/'.$content->file)): ?>
			<a href="<?php echo 'uploads/contents/download/'.$content->file?>"><img src="themes/bie/images/btn_download.gif" /></a>
			<?php endif ?>
		</div>
        <p><?php echo $content->intro ?></p>
        </div>
    	<?php endforeach; ?>
    <div class="clear"></div>
	</div>
	<?php endforeach; ?>
	

	</div><!--tabs-->

</div><!--inspect-->